<script type="text/javascript">
$(document).ready(function(){
	$("select[name=ket_alasan]").change(function(){
		if ($("select[name=ket_alasan]").val() == "Lainnya"){
			$("select[name=account4]").val("1");
			$("textarea[name=alasan]").html("");
			$(".ket-alasan").show();
		} else if($("select[name=ket_alasan]").val() == "CPNS Pusat") {
			$("select[name=account4]").val("2");
			$("textarea[name=alasan]").html($("select[name=ket_alasan]").val());
			$(".ket-alasan").hide();
		} else if ($("select[name=ket_alasan]").val() != ""){
			$("select[name=account4]").val("1");
			$("textarea[name=alasan]").html($("select[name=ket_alasan]").val());
			$(".ket-alasan").hide();
		} else {
			$("select[name=account4]").val("");
			$("textarea[name=alasan]").html($("select[name=ket_alasan]").val());
			$(".ket-alasan").hide();
		}
	});
});
</script>
<style>
 .ket-alasan{
	display:none;
 }
</style>
<section class="panel">
	<head>
		
		<script src="<?php echo base_url();?>js/select2/select2.min.js" cache="false"></script>
	</head>
	<body>
		<div class="panel-body">
			<div class="panel">
				<div class="wizard clearfix" id="form-wizard">
					<ul class="steps">
						<li data-target="#step1" class="active"><span class="badge badge-info">1</span>Biodata</li>
						<li data-target="#step2"><span class="badge">2</span>Upload KTP</li>
						<li data-target="#step3"><span class="badge">3</span>Upload Berkas Pendukung</li>
						<li data-target="#step4"><span class="badge">4</span>Upload Ijazah</li>
						<li data-target="#step5"><span class="badge">5</span>Pengajuan</li>
					</ul>
					<div class="actions">
						<button type="button" class="btn btn-info btn-xs btn-prev" disabled="disabled">Prev</button>
						<button type="button" class="btn btn-info btn-xs btn-next" data-last="Finish">Next</button>
					</div>
				</div>
				<div class="step-content">
					<?php foreach($show as $row): ?> 
					<?php echo form_open_multipart('pengajuan/addpermohonan', 'name ="f1" class="bs-example form-horizontal" data-parsley-validate');?> 
					<div class="step-pane active" id="step1">
						<div class="form-group">
							<label class="col-sm-2 control-label">Nama lengkap</label>
							<div class="col-sm-9">
								<input type="text" name = "nama_lengkap" class="form-control" required value="<?php echo $row->NAMA_LENGKAP?>" data-parsley-trigger="focusout">
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-2 control-label">Tempat lahir</label>
							<div class="col-sm-9">
								<input type="text" name="tempat_lahir" class="form-control" required value="<?php echo $row->TEMPAT_LAHIR?>" data-parsley-trigger="focusout" data-parsley-error-message="Harus Diisi">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Tanggal lahir</label>
							<div class="col-sm-9">
								<input class="datepicker-input form-control" name="tanggal_lahir" required type="text" data-date-format="dd-mm-yyyy" value="<?php echo $row->TGL_LAHIR?>" data-parsley-trigger="focusout" data-parsley-error-message="Harus Diisi">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Jenis kelamin</label>
							<div class="col-sm-9">
								<div class="radio-inline">
									<label>
										<input type="radio" <?php if($row->JENIS_KELAMIN == 1) echo 'checked'?> name="jenis_kelamin" id="optionsRadios1" value="1">
									Laki-laki
									</label>
								</div>
								<div class="radio-inline">
									<label>
										<input type="radio" <?php if($row->JENIS_KELAMIN == 2) echo 'checked'?> name="jenis_kelamin" id="optionsRadios2" value="2">
									Perempuan
									</label>
								</div>
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Alamat</label>
							<div class="col-sm-9">
								<input type="text" name="alamat" class="form-control" required value="<?php echo $row->ALAMAT?>" data-parsley-trigger="focusout" data-parsley-error-message="Harus diisi">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nomor telepon</label>
							<div class="col-sm-9">
								<input type="number" name = "nomor_telepon" class="form-control" required value="<?php echo $row->TELP?>" data-parsley-trigger="focusout" data-parsley-error-message="Mohon Diisi Dengan Angka">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nomor handphone</label>
							<div class="col-sm-9">
								<input type="number" name="hp" class="form-control" required value="<?php echo $row->HP?>" data-parsley-trigger="focusout" data-parsley-error-message="Mohon Diisi Dengan Angka">
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Email</label>
							<div class="col-sm-9">
								<input type="email" class="form-control" disabled value="<?php echo $row->EMAIL?>" data-parsley-trigger="focusout">
							</div>
						</div>
					</div>
					<div class="step-pane" id="step2">
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload KTP</label>
							<div class="col-sm-9">
								<input type="file" name="file_0" required title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
					</div>
					<div class="step-pane" id="step3">
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload Berkas Pendukung</label>
							<div class="col-sm-9">
								<input type="file" name="file_4" title="Browse" class="btn btn-sm btn-info file-input">
							</div>
						</div>
					</div>
					<div class="step-pane" id="step4">
						<div class="form-group">
							<label class="col-sm-2 control-label">Jenjang pendidikan</label>
							<div class="col-sm-9">
								<label class="checkbox-inline">
									<input type="checkbox" id="inlineCheckbox1" name="paket1" value="1" onclick="enable_text4(this.checked)" /> SD/PAKET A
								</label>
								<label class="checkbox-inline">
									<input type="checkbox" id="inlineCheckbox2" name="paket2" value="2" onclick="enable_text3(this.checked)" /> SMP/PAKET B
								</label>
								<label class="checkbox-inline">
									<input type="checkbox" id="inlineCheckbox3" name="paket3" value="3" onclick="enable_text2(this.checked)"/> SMA/PAKET C
								</label>									
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nama SD/PAKET A</label>
							<div class="col-sm-9">
								<select class="select2 sd" name="sd" data-required="true" style="width:300px;" disabled="disabled">
									<option value="">-- Pilih SD terlebih dahulu --</option>
									<?php
									foreach($sd as $row){
									?>
									<option value="<?php echo $row["NAMA"]; ?>"><?php echo $row["NAMA"]; ?></option>
									<?php
									}
									?>
								</select>
							</div>
						</div>						
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian depan</label>
							<div class="col-sm-9">
								<input type="file" name="file_1" title="Browse" class="btn btn-sm btn-info file-input sd" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian belakang</label>
							<div class="col-sm-9">
								<input type="file" name="file_5" title="Browse" class="btn btn-sm btn-info file-input sd" disabled="disabled">
							</div>
						</div>	
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nama SMP/PAKET B</label>
							<div class="col-sm-9">
								<select class="select2 smp" name="smp" data-required="true" style="width:300px;" disabled="disabled">
									<option value="">-- Pilih SMP terlebih dahulu --</option>
									<?php
									foreach($smp as $row){
									?>
									<option value="<?php echo $row["NAMA"]; ?>"><?php echo $row["NAMA"]; ?></option>
									<?php
									}
									?>
								</select>
							</div>
						</div>								
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian depan</label>
							<div class="col-sm-9">
								<input type="file" name="file_2" title="Browse" class="btn btn-sm btn-info file-input smp" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian belakang</label>
							<div class="col-sm-9">
								<input type="file" name="file_6" title="Browse" class="btn btn-sm btn-info file-input smp" disabled="disabled">
							</div>
						</div>						
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Nama SMA/PAKET C</label>
							<div class="col-sm-9">
								<select class="select2 sma" name="sma" data-required="true" style="width:300px;" disabled="disabled">
									<option value="">-- Pilih SMA terlebih dahulu --</option>
									<?php
									foreach($sma as $row){
									?>
									<option value="<?php echo $row["NAMA"]; ?>"><?php echo $row["NAMA"]; ?></option>
									<?php
									}
									?>
								</select>
							</div>
						</div>							
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian depan</label>
							<div class="col-sm-9">
								<input type="file" name="file_3" title="Browse" class="btn btn-sm btn-info file-input sma" disabled="disabled">
							</div>
						</div>	
						<div class="form-group">
							<label class="col-sm-2 control-label">Upload ijazah bagian belakang</label>
							<div class="col-sm-9">
								<input type="file" name="file_7" title="Browse" class="btn btn-sm btn-info file-input sma" disabled="disabled">
							</div>
						</div>							
					</div>
					<div class="step-pane" id="step5">
						<div class="form-group">
							<label class="col-sm-3 control-label">Tanggal permohonan</label>
							<div class="col-sm-8">
								<input class="form-control" name="tanggal_permohonan" data-required="true" type="text" data-date-format="dd-mm-yyyy" value="<?php echo date('d-m-Y');?>" disabled>
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Alasan pengajuan</label>
							<div class="col-sm-8">
								<select name="ket_alasan" class="form-control m-b">
									<option value="">Pilih alasan pengajuan</option>
									<option value="STPDN">STPDN</option>
									<option value="CPNS Pusat">CPNS Pusat</option>
									<option value="CPNS Daerah">CPNS Daerah</option>
									<option value="TNI (AD / AL / AU)">TNI (AD / AL / AU)</option>
									<option value="POLRI">POLRI</option>
									<option value="SWASTA">SWASTA</option>
									<option value="Lainnya">Lainnya</option>
								</select>
							</div>
							<label class="col-sm-3 control-label ket-alasan">&nbsp;</label>
							<div class="col-sm-8 ket-alasan">
								<textarea class="form-control" name = "alasan" rows="3"></textarea>
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Jumlah legalisir ijazah SD</label>
							<div class="col-sm-8">
								<select name="account1" id ="sd3" class="form-control m-b sd" disabled>
									<option value="">Pilih Jumlah lembar</option>
									<option value="1">1</option>
									<option value="2">2</option>
									<option value="3">3</option>
									<option value="4">4</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7">7</option>
								</select>
							</div>
						</div>							
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Jumlah legalisir ijazah SMP</label>
							<div class="col-sm-8">
								<select name="account2" id ="smp3" class="form-control m-b smp" disabled>
									<option value="">Pilih Jumlah lembar</option>
									<option value="1">1</option>
									<option value="2">2</option>
									<option value="3">3</option>
									<option value="4">4</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7">7</option>
								</select>
							</div>
						</div>							
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Jumlah legalisir ijazah SMA</label>
							<div class="col-sm-8">
								<select name="account3" id ="sma3" class="form-control m-b sma" disabled>
									<option value="">Pilih Jumlah lembar</option>
									<option value="1">1</option>
									<option value="2">2</option>
									<option value="3">3</option>
									<option value="4">4</option>
									<option value="5">5</option>
									<option value="6">6</option>
									<option value="7">7</option>
								</select>
							</div>
						</div>
						<div class="line line-dashed line-lg pull-in"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Penanda tangan</label>
							<div class="col-sm-8">
								<select name="account4" id="verifikator" class="form-control m-b" readonly>
									<option value="">Pilih alasan pengajuan terlebih dahulu</option>
									<option value="1">Sekretaris</option>
									<option value="2">Kepala dinas</option>
								</select>
							</div>
						</div>
						<div class="form-group">			
							<div class="col-lg-11 control-label">
								<div class="doc-buttons">
									<button class="btn btn-sm btn-info"><i class="fa fa-pencil text"></i><span class="text"> Ajukan</span></button>
								</div>
							</div>				
						</div>								
					</div>
					<?php 
					echo form_close();
					endforeach; 
					?>
				</div>
			</div>
		</div>
	</body>
</section>
  <script language="javascript">
	 $(".select2").select2();
	 function enable_text4(name){
		if(name == true){
			$(".sd").prop( "disabled", false );
			$(".sd").prop("required", true);
		} else {
			$(".sd").prop( "disabled", true );
			$(".sd").prop("required", false);
		}
	 }
	 function enable_text3(name){
		if(name == true){
			$(".smp").prop( "disabled", false );
			$(".smp").prop("required", true);
		} else {
			$(".smp").prop( "disabled", true );
			$(".smp").prop("required", false);
		}
	 }
	 function enable_text2(name){
		if(name == true){
			$(".sma").prop( "disabled", false );
			$(".sma").prop("required", true);
		} else {
			$(".sma").prop( "disabled", true );
			$(".sma").prop("required", false);
		}
	 }
  </script>